package com.campus.counseling.model.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.campus.counseling.entity.ChatAnalysis;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface ChatAnalysisMapper extends BaseMapper<ChatAnalysis> {
    
    @Select("SELECT * FROM chat_analysis WHERE user_id = #{userId} ORDER BY create_time DESC")
    List<ChatAnalysis> findByUserId(Long userId);
    
    @Select("SELECT * FROM chat_analysis WHERE user_id = #{userId} ORDER BY analysis_time DESC LIMIT 1")
    ChatAnalysis findLatestByUserId(Long userId);
} 